-
Notifications
You must be signed in to change notification settings - Fork 940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solution #776
base: master
Are you sure you want to change the base?
solution #776
Conversation
app/battle/battle_file.py
Outdated
first_knight.hp -= second_knight.power - first_knight.protection | ||
second_knight.hp -= first_knight.power - second_knight.protection | ||
|
||
if first_knight.hp <= 0: | ||
first_knight.hp = 0 | ||
|
||
if second_knight.hp <= 0: | ||
second_knight.hp = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use function max()
in order to get rid of conditions
app/knight_info/potion.py
Outdated
self.effect = effect | ||
|
||
def get_hp(self) -> int: | ||
return self.effect["hp"] if "hp" in self.effect else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use get function with default value intead here, same for functions below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You even can avoid creation of this functions, use get instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ!
No description provided.